package com.fingard.dsp.bank.reqrespobj.batchbill;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.batchbill.detail.ReqBatOpenBillSubmitDetail;
import com.fingard.xml.XmlTextReader;

/**
 * Created by F on 2019/10/21.
 */
public class ReqBatOpenBillSubmit extends RequestBase {
    public ReqBatOpenBillSubmitDetail detail;
    private XmlTextReader xmlReader;

    /**
     * 协议号
     */
    public String protocolNo ="";
    /**
     * 批次号
     */
    public String psselNum ="";
    /**
     * 总金额
     */
    public String totalAmount ="";
    /**
     * 总笔数
     */
    public String totalNum ="";
    /**
     * 票据种类
     */
    public String billType ="";
    /**
     * 合同起始日
     */
    public String contractStart ="";
    /**
     * 合同到期日
     */
    public String contractEnd ="";
    /**
     * 发票号码
     */
    public String invoiceNo ="";
    /**
     * 合同编号
     */
    public String bargainNo ="";
    /**
     * 占用授信金额
     */
    public String creditBreedAmt ="";
    /**
     * 保证金账户
     */
    public String marginAcct ="";
    /**
     * 手续费扣收账户
     */
    public String commissionChargeAcct ="";
    /**
     * 承兑人是否同行
     */
    public String accpSameBnk ="";
    /**
     * 批次号
     */
    public String reqBatchNo ="";
    /**
     * 出票人名称
     */
    public String drawName ="";
    /**
     * 出票人账号
     */
    public String drawAct ="";
    /**
     * 出票人直联区域
     */
    public String drawActArea ="";
    /**
     * 出票人组织
     */
    public String drawCode ="";
    /**
     * 出票人开户行名称
     */
    public String drawBnkName ="";
    /**
     * 出票人开户行行号
     */
    public String drawBnkCode ="";
    /**
     * 出票人信用等级
     */
    public String creditLv ="";
    /**
     * 出票人评级机构
     */
    public String gradeAgent ="";
    /**
     * 评级到期日
     */
    public String gradeDueDate ="";
    /**
     * 开票方式
     */
    public String openBillType ="";
    /**
     * 备用1
     */
    public String reqReserve1 ="";
    /**
     * 备用2
     */
    public String reqReserve2 ="";

    public boolean readRecord() throws Exception {
        detail = null;
        if (xmlReader.read("/ATSYH/TransReq/TransParam/DetailRecord")) {
            detail = new ReqBatOpenBillSubmitDetail(xmlReader.readedXElement);
            return true;
        } else {
            return false;
        }
    }

    public ReqBatOpenBillSubmit(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception {
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        protocolNo = xmlReader.getSimpleText("ProtocolNo");
        totalAmount = xmlReader.getSimpleText("TotalAmount");
        totalNum = xmlReader.getSimpleText("TotalNum");
        billType = xmlReader.getSimpleText("BillType");
        contractStart = xmlReader.getSimpleText("ContractStart");
        contractEnd = xmlReader.getSimpleText("ContractEnd");
        invoiceNo = xmlReader.getSimpleText("InvoiceNo");
        bargainNo = xmlReader.getSimpleText("BargainNo");
        creditBreedAmt = xmlReader.getSimpleText("CreditBreedAmt");
        marginAcct = xmlReader.getSimpleText("MarginAcct");
        commissionChargeAcct = xmlReader.getSimpleText("CommissionChargeAcct");
        accpSameBnk = xmlReader.getSimpleText("AccpSameBnk");
        reqBatchNo = xmlReader.getSimpleText("ReqSeqID");
        psselNum = xmlReader.getSimpleText("PsselNum");
        drawName = xmlReader.getSimpleText("DrawName");
        drawAct = xmlReader.getSimpleText("DrawAct");
        drawActArea = xmlReader.getSimpleText("DrawActArea");
        drawCode = xmlReader.getSimpleText("DrawCode");
        drawBnkName = xmlReader.getSimpleText("DrawBnkName");
        drawBnkCode = xmlReader.getSimpleText("DrawBnkCode");
        creditLv = xmlReader.getSimpleText("CreditLv");
        gradeAgent = xmlReader.getSimpleText("GradeAgent");
        gradeDueDate = xmlReader.getSimpleText("GradeDueDate");
        openBillType =xmlReader.getSimpleText("OpenBillType");
        reqReserve1 = xmlReader.getSimpleText("ReqReserve1");
        reqReserve2 = xmlReader.getSimpleText("ReqReserve2");
    }
}
